The data for this report was pulled via the NetSuite saved search “product-data-fields-trimmed” on 2024-01-31.
Note that all sections of this report exclude the following sets of records:
Also note that Closeout items are treated here as belonging to the “Vendor” Closeouts.
Here are summaries by supplier details pertinent to products eligible
to be live on the site by setting the value of
Display in Web Site to Manufacturer65. These counts may include
products already live on the site.
# for (i in 1:6) {
# run_report(item_health_template, ns_dat_list[[i]], paste0("### ", names(ns_dat_list)[i]))
# }
run_report(item_health_template, ns_dat_list[[1]], paste0("### ", names(ns_dat_list)[1]))
dat %>%
select(-any_of("WRA_prob_list")) %>%
select(robs_vendor_name, contains("WRA_")) %>%
mutate(sum = rowSums(across(where(is.logical)))) %>%
group_by(robs_vendor_name) %>%
summarise(`Overall Data Readiness Percentage` = mean(sum) / length(wra_names)) %>%
select(robs_vendor_name, `Overall Data Readiness Percentage`) %>%
identity() -> overall_readiness_lookup_df
dat %>%
bind_rows(tibble(
robs_vendor_name = c("fake", "fake"),
readiness_alignment = c("opportunity", "liability"),
n = c("0", "0")
)) %>%
count(robs_vendor_name, readiness_alignment) %>%
mutate(
readiness_alignment = readiness_alignment %>%
str_to_lower %>%
str_replace(" ", "_")
) %>%
pivot_wider(names_from = readiness_alignment, values_from = n, values_fill = 0) %>%
identity() -> readiness_alignment_lookup_df
dat %>%
count(robs_vendor_name,
DIWS_ready_counts = ifelse(DIWS_ready, "DIWS Ready", "Not DIWS Ready")) %>%
left_join(overall_readiness_lookup_df) %>%
left_join({
dat %>%
filter(`Display in Web Site` == "Yes") %>%
count(robs_vendor_name, name = "Live")
}) %>%
mutate(across(everything(), as.character)) %>%
bind_rows(tibble(
robs_vendor_name = c("fake", "fake"),
DIWS_ready_counts = c("DIWS Ready", "Not DIWS Ready"),
n = c("0", "0")
)) %>%
mutate(across(everything(), parse_guess)) %>%
pivot_wider(names_from = DIWS_ready_counts, values_from = n, values_fill = 0) %>%
mutate(
`Total Product Count` = `DIWS Ready` + `Not DIWS Ready`,
`DIWS Ready %` = `DIWS Ready` / `Total Product Count`,
Live = case_when(!is.na(Live) ~ Live, Manufacturer65 ~ 0),
`Live %` = Live / `Total Product Count`
) %>%
left_join(readiness_alignment_lookup_df) %>%
filter(robs_vendor_name != "fake") %>%
identity() -> ready_df
dat %>%
select(-any_of("WRA_prob_list")) %>%
filter(!DIWS_ready) %>%
select(Name, robs_vendor_name, contains("WRA_")) %>%
rename_with(~{str_remove(.x, "WRA_")}) %>%
pivot_longer(-c(Name, robs_vendor_name), names_to = "assessment", values_to = "assessment_is_good") %>%
filter(!assessment_is_good) %>%
count(robs_vendor_name, assessment, sort = T) %>%
mutate(prob_counts = paste0(assessment, "_", n)) %>%
select(-assessment)%>%
group_by(robs_vendor_name) %>%
summarise(
prob_count = sum(n),
prob_type_count = n(),
count_type_ratio = (prob_count / prob_type_count) %>% round(2),
prob_list = paste0(prob_counts, collapse = ", ")
) %>%
full_join(ready_df) %>%
select(
Vendor = robs_vendor_name,
`Total Product Count`,
Live, `Live %`,
`Opportunity Count` = opportunity,
`Liability Count` = liability,
`DIWS Product Ready Count` = `DIWS Ready`,
`DIWS Product Ready Percentage` = `DIWS Ready %`,
`Not DIWS Ready`,
`Overall Data Readiness Percentage`,
`Problem Value Count` = prob_count,
`Problem Type Count` = prob_type_count,
`Problem List` = prob_list
) %>%
# filter(Vendor == "Manufacturer63")
identity() -> table_to_print
col_hide_list <- c("Live", "Live %", "Opportunity Count", "Liability Count", "Problem List")
col_hide_targets <- which(colnames(table_to_print) %in% col_hide_list) - 1
table_to_print %>%
datatable(
rownames = F,
filter = "top",
extensions = "Buttons",
options = list(
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis"),
columnDefs = list(
list(extend = 'colvis', visible = F, targets = col_hide_targets),
list(width = "20%", targets = 0)
)
)
) %>%
formatPercentage(c(
"Live %",
"DIWS Product Ready Percentage",
"Overall Data Readiness Percentage"
), 1) %>%
formatStyle("DIWS Product Ready Percentage",
background = styleColorBar(
table_to_print$`DIWS Product Ready Percentage`, 'lightgreen'),
backgroundSize = '95% 50%',
backgroundRepeat = 'no-repeat',
backgroundPosition = 'right') %>%
formatStyle("Overall Data Readiness Percentage",
background = styleColorBar(
table_to_print$`Overall Data Readiness Percentage`, 'lightblue'),
backgroundSize = '95% 50%',
backgroundRepeat = 'no-repeat',
backgroundPosition = 'right')
run_report(item_health_template, ns_dat_list[[2]], paste0("### ", names(ns_dat_list)[2]))
dat %>%
select(-any_of("WRA_prob_list")) %>%
select(robs_vendor_name, contains("WRA_")) %>%
mutate(sum = rowSums(across(where(is.logical)))) %>%
group_by(robs_vendor_name) %>%
summarise(`Overall Data Readiness Percentage` = mean(sum) / length(wra_names)) %>%
select(robs_vendor_name, `Overall Data Readiness Percentage`) %>%
identity() -> overall_readiness_lookup_df
dat %>%
bind_rows(tibble(
robs_vendor_name = c("fake", "fake"),
readiness_alignment = c("opportunity", "liability"),
n = c("0", "0")
)) %>%
count(robs_vendor_name, readiness_alignment) %>%
mutate(
readiness_alignment = readiness_alignment %>%
str_to_lower %>%
str_replace(" ", "_")
) %>%
pivot_wider(names_from = readiness_alignment, values_from = n, values_fill = 0) %>%
identity() -> readiness_alignment_lookup_df
dat %>%
count(robs_vendor_name,
DIWS_ready_counts = ifelse(DIWS_ready, "DIWS Ready", "Not DIWS Ready")) %>%
left_join(overall_readiness_lookup_df) %>%
left_join({
dat %>%
filter(`Display in Web Site` == "Yes") %>%
count(robs_vendor_name, name = "Live")
}) %>%
mutate(across(everything(), as.character)) %>%
bind_rows(tibble(
robs_vendor_name = c("fake", "fake"),
DIWS_ready_counts = c("DIWS Ready", "Not DIWS Ready"),
n = c("0", "0")
)) %>%
mutate(across(everything(), parse_guess)) %>%
pivot_wider(names_from = DIWS_ready_counts, values_from = n, values_fill = 0) %>%
mutate(
`Total Product Count` = `DIWS Ready` + `Not DIWS Ready`,
`DIWS Ready %` = `DIWS Ready` / `Total Product Count`,
Live = case_when(!is.na(Live) ~ Live, Manufacturer65 ~ 0),
`Live %` = Live / `Total Product Count`
) %>%
left_join(readiness_alignment_lookup_df) %>%
filter(robs_vendor_name != "fake") %>%
identity() -> ready_df
dat %>%
select(-any_of("WRA_prob_list")) %>%
filter(!DIWS_ready) %>%
select(Name, robs_vendor_name, contains("WRA_")) %>%
rename_with(~{str_remove(.x, "WRA_")}) %>%
pivot_longer(-c(Name, robs_vendor_name), names_to = "assessment", values_to = "assessment_is_good") %>%
filter(!assessment_is_good) %>%
count(robs_vendor_name, assessment, sort = T) %>%
mutate(prob_counts = paste0(assessment, "_", n)) %>%
select(-assessment)%>%
group_by(robs_vendor_name) %>%
summarise(
prob_count = sum(n),
prob_type_count = n(),
count_type_ratio = (prob_count / prob_type_count) %>% round(2),
prob_list = paste0(prob_counts, collapse = ", ")
) %>%
full_join(ready_df) %>%
select(
Vendor = robs_vendor_name,
`Total Product Count`,
Live, `Live %`,
`Opportunity Count` = opportunity,
`Liability Count` = liability,
`DIWS Product Ready Count` = `DIWS Ready`,
`DIWS Product Ready Percentage` = `DIWS Ready %`,
`Not DIWS Ready`,
`Overall Data Readiness Percentage`,
`Problem Value Count` = prob_count,
`Problem Type Count` = prob_type_count,
`Problem List` = prob_list
) %>%
# filter(Vendor == "Manufacturer63")
identity() -> table_to_print
col_hide_list <- c("Live", "Live %", "Opportunity Count", "Liability Count", "Problem List")
col_hide_targets <- which(colnames(table_to_print) %in% col_hide_list) - 1
table_to_print %>%
datatable(
rownames = F,
filter = "top",
extensions = "Buttons",
options = list(
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis"),
columnDefs = list(
list(extend = 'colvis', visible = F, targets = col_hide_targets),
list(width = "20%", targets = 0)
)
)
) %>%
formatPercentage(c(
"Live %",
"DIWS Product Ready Percentage",
"Overall Data Readiness Percentage"
), 1) %>%
formatStyle("DIWS Product Ready Percentage",
background = styleColorBar(
table_to_print$`DIWS Product Ready Percentage`, 'lightgreen'),
backgroundSize = '95% 50%',
backgroundRepeat = 'no-repeat',
backgroundPosition = 'right') %>%
formatStyle("Overall Data Readiness Percentage",
background = styleColorBar(
table_to_print$`Overall Data Readiness Percentage`, 'lightblue'),
backgroundSize = '95% 50%',
backgroundRepeat = 'no-repeat',
backgroundPosition = 'right')
run_report(item_health_template, ns_dat_list[[3]], paste0("### ", names(ns_dat_list)[3]))
dat %>%
select(-any_of("WRA_prob_list")) %>%
select(robs_vendor_name, contains("WRA_")) %>%
mutate(sum = rowSums(across(where(is.logical)))) %>%
group_by(robs_vendor_name) %>%
summarise(`Overall Data Readiness Percentage` = mean(sum) / length(wra_names)) %>%
select(robs_vendor_name, `Overall Data Readiness Percentage`) %>%
identity() -> overall_readiness_lookup_df
dat %>%
bind_rows(tibble(
robs_vendor_name = c("fake", "fake"),
readiness_alignment = c("opportunity", "liability"),
n = c("0", "0")
)) %>%
count(robs_vendor_name, readiness_alignment) %>%
mutate(
readiness_alignment = readiness_alignment %>%
str_to_lower %>%
str_replace(" ", "_")
) %>%
pivot_wider(names_from = readiness_alignment, values_from = n, values_fill = 0) %>%
identity() -> readiness_alignment_lookup_df
dat %>%
count(robs_vendor_name,
DIWS_ready_counts = ifelse(DIWS_ready, "DIWS Ready", "Not DIWS Ready")) %>%
left_join(overall_readiness_lookup_df) %>%
left_join({
dat %>%
filter(`Display in Web Site` == "Yes") %>%
count(robs_vendor_name, name = "Live")
}) %>%
mutate(across(everything(), as.character)) %>%
bind_rows(tibble(
robs_vendor_name = c("fake", "fake"),
DIWS_ready_counts = c("DIWS Ready", "Not DIWS Ready"),
n = c("0", "0")
)) %>%
mutate(across(everything(), parse_guess)) %>%
pivot_wider(names_from = DIWS_ready_counts, values_from = n, values_fill = 0) %>%
mutate(
`Total Product Count` = `DIWS Ready` + `Not DIWS Ready`,
`DIWS Ready %` = `DIWS Ready` / `Total Product Count`,
Live = case_when(!is.na(Live) ~ Live, Manufacturer65 ~ 0),
`Live %` = Live / `Total Product Count`
) %>%
left_join(readiness_alignment_lookup_df) %>%
filter(robs_vendor_name != "fake") %>%
identity() -> ready_df
dat %>%
select(-any_of("WRA_prob_list")) %>%
filter(!DIWS_ready) %>%
select(Name, robs_vendor_name, contains("WRA_")) %>%
rename_with(~{str_remove(.x, "WRA_")}) %>%
pivot_longer(-c(Name, robs_vendor_name), names_to = "assessment", values_to = "assessment_is_good") %>%
filter(!assessment_is_good) %>%
count(robs_vendor_name, assessment, sort = T) %>%
mutate(prob_counts = paste0(assessment, "_", n)) %>%
select(-assessment)%>%
group_by(robs_vendor_name) %>%
summarise(
prob_count = sum(n),
prob_type_count = n(),
count_type_ratio = (prob_count / prob_type_count) %>% round(2),
prob_list = paste0(prob_counts, collapse = ", ")
) %>%
full_join(ready_df) %>%
select(
Vendor = robs_vendor_name,
`Total Product Count`,
Live, `Live %`,
`Opportunity Count` = opportunity,
`Liability Count` = liability,
`DIWS Product Ready Count` = `DIWS Ready`,
`DIWS Product Ready Percentage` = `DIWS Ready %`,
`Not DIWS Ready`,
`Overall Data Readiness Percentage`,
`Problem Value Count` = prob_count,
`Problem Type Count` = prob_type_count,
`Problem List` = prob_list
) %>%
# filter(Vendor == "Manufacturer63")
identity() -> table_to_print
col_hide_list <- c("Live", "Live %", "Opportunity Count", "Liability Count", "Problem List")
col_hide_targets <- which(colnames(table_to_print) %in% col_hide_list) - 1
table_to_print %>%
datatable(
rownames = F,
filter = "top",
extensions = "Buttons",
options = list(
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis"),
columnDefs = list(
list(extend = 'colvis', visible = F, targets = col_hide_targets),
list(width = "20%", targets = 0)
)
)
) %>%
formatPercentage(c(
"Live %",
"DIWS Product Ready Percentage",
"Overall Data Readiness Percentage"
), 1) %>%
formatStyle("DIWS Product Ready Percentage",
background = styleColorBar(
table_to_print$`DIWS Product Ready Percentage`, 'lightgreen'),
backgroundSize = '95% 50%',
backgroundRepeat = 'no-repeat',
backgroundPosition = 'right') %>%
formatStyle("Overall Data Readiness Percentage",
background = styleColorBar(
table_to_print$`Overall Data Readiness Percentage`, 'lightblue'),
backgroundSize = '95% 50%',
backgroundRepeat = 'no-repeat',
backgroundPosition = 'right')
run_report(item_health_template, ns_dat_list[[4]], paste0("### ", names(ns_dat_list)[4]))
dat %>%
select(-any_of("WRA_prob_list")) %>%
select(robs_vendor_name, contains("WRA_")) %>%
mutate(sum = rowSums(across(where(is.logical)))) %>%
group_by(robs_vendor_name) %>%
summarise(`Overall Data Readiness Percentage` = mean(sum) / length(wra_names)) %>%
select(robs_vendor_name, `Overall Data Readiness Percentage`) %>%
identity() -> overall_readiness_lookup_df
dat %>%
bind_rows(tibble(
robs_vendor_name = c("fake", "fake"),
readiness_alignment = c("opportunity", "liability"),
n = c("0", "0")
)) %>%
count(robs_vendor_name, readiness_alignment) %>%
mutate(
readiness_alignment = readiness_alignment %>%
str_to_lower %>%
str_replace(" ", "_")
) %>%
pivot_wider(names_from = readiness_alignment, values_from = n, values_fill = 0) %>%
identity() -> readiness_alignment_lookup_df
dat %>%
count(robs_vendor_name,
DIWS_ready_counts = ifelse(DIWS_ready, "DIWS Ready", "Not DIWS Ready")) %>%
left_join(overall_readiness_lookup_df) %>%
left_join({
dat %>%
filter(`Display in Web Site` == "Yes") %>%
count(robs_vendor_name, name = "Live")
}) %>%
mutate(across(everything(), as.character)) %>%
bind_rows(tibble(
robs_vendor_name = c("fake", "fake"),
DIWS_ready_counts = c("DIWS Ready", "Not DIWS Ready"),
n = c("0", "0")
)) %>%
mutate(across(everything(), parse_guess)) %>%
pivot_wider(names_from = DIWS_ready_counts, values_from = n, values_fill = 0) %>%
mutate(
`Total Product Count` = `DIWS Ready` + `Not DIWS Ready`,
`DIWS Ready %` = `DIWS Ready` / `Total Product Count`,
Live = case_when(!is.na(Live) ~ Live, Manufacturer65 ~ 0),
`Live %` = Live / `Total Product Count`
) %>%
left_join(readiness_alignment_lookup_df) %>%
filter(robs_vendor_name != "fake") %>%
identity() -> ready_df
dat %>%
select(-any_of("WRA_prob_list")) %>%
filter(!DIWS_ready) %>%
select(Name, robs_vendor_name, contains("WRA_")) %>%
rename_with(~{str_remove(.x, "WRA_")}) %>%
pivot_longer(-c(Name, robs_vendor_name), names_to = "assessment", values_to = "assessment_is_good") %>%
filter(!assessment_is_good) %>%
count(robs_vendor_name, assessment, sort = T) %>%
mutate(prob_counts = paste0(assessment, "_", n)) %>%
select(-assessment)%>%
group_by(robs_vendor_name) %>%
summarise(
prob_count = sum(n),
prob_type_count = n(),
count_type_ratio = (prob_count / prob_type_count) %>% round(2),
prob_list = paste0(prob_counts, collapse = ", ")
) %>%
full_join(ready_df) %>%
select(
Vendor = robs_vendor_name,
`Total Product Count`,
Live, `Live %`,
`Opportunity Count` = opportunity,
`Liability Count` = liability,
`DIWS Product Ready Count` = `DIWS Ready`,
`DIWS Product Ready Percentage` = `DIWS Ready %`,
`Not DIWS Ready`,
`Overall Data Readiness Percentage`,
`Problem Value Count` = prob_count,
`Problem Type Count` = prob_type_count,
`Problem List` = prob_list
) %>%
# filter(Vendor == "Manufacturer63")
identity() -> table_to_print
col_hide_list <- c("Live", "Live %", "Opportunity Count", "Liability Count", "Problem List")
col_hide_targets <- which(colnames(table_to_print) %in% col_hide_list) - 1
table_to_print %>%
datatable(
rownames = F,
filter = "top",
extensions = "Buttons",
options = list(
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis"),
columnDefs = list(
list(extend = 'colvis', visible = F, targets = col_hide_targets),
list(width = "20%", targets = 0)
)
)
) %>%
formatPercentage(c(
"Live %",
"DIWS Product Ready Percentage",
"Overall Data Readiness Percentage"
), 1) %>%
formatStyle("DIWS Product Ready Percentage",
background = styleColorBar(
table_to_print$`DIWS Product Ready Percentage`, 'lightgreen'),
backgroundSize = '95% 50%',
backgroundRepeat = 'no-repeat',
backgroundPosition = 'right') %>%
formatStyle("Overall Data Readiness Percentage",
background = styleColorBar(
table_to_print$`Overall Data Readiness Percentage`, 'lightblue'),
backgroundSize = '95% 50%',
backgroundRepeat = 'no-repeat',
backgroundPosition = 'right')
run_report(item_health_template, ns_dat_list[[5]], paste0("### ", names(ns_dat_list)[5]))
dat %>%
select(-any_of("WRA_prob_list")) %>%
select(robs_vendor_name, contains("WRA_")) %>%
mutate(sum = rowSums(across(where(is.logical)))) %>%
group_by(robs_vendor_name) %>%
summarise(`Overall Data Readiness Percentage` = mean(sum) / length(wra_names)) %>%
select(robs_vendor_name, `Overall Data Readiness Percentage`) %>%
identity() -> overall_readiness_lookup_df
dat %>%
bind_rows(tibble(
robs_vendor_name = c("fake", "fake"),
readiness_alignment = c("opportunity", "liability"),
n = c("0", "0")
)) %>%
count(robs_vendor_name, readiness_alignment) %>%
mutate(
readiness_alignment = readiness_alignment %>%
str_to_lower %>%
str_replace(" ", "_")
) %>%
pivot_wider(names_from = readiness_alignment, values_from = n, values_fill = 0) %>%
identity() -> readiness_alignment_lookup_df
dat %>%
count(robs_vendor_name,
DIWS_ready_counts = ifelse(DIWS_ready, "DIWS Ready", "Not DIWS Ready")) %>%
left_join(overall_readiness_lookup_df) %>%
left_join({
dat %>%
filter(`Display in Web Site` == "Yes") %>%
count(robs_vendor_name, name = "Live")
}) %>%
mutate(across(everything(), as.character)) %>%
bind_rows(tibble(
robs_vendor_name = c("fake", "fake"),
DIWS_ready_counts = c("DIWS Ready", "Not DIWS Ready"),
n = c("0", "0")
)) %>%
mutate(across(everything(), parse_guess)) %>%
pivot_wider(names_from = DIWS_ready_counts, values_from = n, values_fill = 0) %>%
mutate(
`Total Product Count` = `DIWS Ready` + `Not DIWS Ready`,
`DIWS Ready %` = `DIWS Ready` / `Total Product Count`,
Live = case_when(!is.na(Live) ~ Live, Manufacturer65 ~ 0),
`Live %` = Live / `Total Product Count`
) %>%
left_join(readiness_alignment_lookup_df) %>%
filter(robs_vendor_name != "fake") %>%
identity() -> ready_df
dat %>%
select(-any_of("WRA_prob_list")) %>%
filter(!DIWS_ready) %>%
select(Name, robs_vendor_name, contains("WRA_")) %>%
rename_with(~{str_remove(.x, "WRA_")}) %>%
pivot_longer(-c(Name, robs_vendor_name), names_to = "assessment", values_to = "assessment_is_good") %>%
filter(!assessment_is_good) %>%
count(robs_vendor_name, assessment, sort = T) %>%
mutate(prob_counts = paste0(assessment, "_", n)) %>%
select(-assessment)%>%
group_by(robs_vendor_name) %>%
summarise(
prob_count = sum(n),
prob_type_count = n(),
count_type_ratio = (prob_count / prob_type_count) %>% round(2),
prob_list = paste0(prob_counts, collapse = ", ")
) %>%
full_join(ready_df) %>%
select(
Vendor = robs_vendor_name,
`Total Product Count`,
Live, `Live %`,
`Opportunity Count` = opportunity,
`Liability Count` = liability,
`DIWS Product Ready Count` = `DIWS Ready`,
`DIWS Product Ready Percentage` = `DIWS Ready %`,
`Not DIWS Ready`,
`Overall Data Readiness Percentage`,
`Problem Value Count` = prob_count,
`Problem Type Count` = prob_type_count,
`Problem List` = prob_list
) %>%
# filter(Vendor == "Manufacturer63")
identity() -> table_to_print
col_hide_list <- c("Live", "Live %", "Opportunity Count", "Liability Count", "Problem List")
col_hide_targets <- which(colnames(table_to_print) %in% col_hide_list) - 1
table_to_print %>%
datatable(
rownames = F,
filter = "top",
extensions = "Buttons",
options = list(
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis"),
columnDefs = list(
list(extend = 'colvis', visible = F, targets = col_hide_targets),
list(width = "20%", targets = 0)
)
)
) %>%
formatPercentage(c(
"Live %",
"DIWS Product Ready Percentage",
"Overall Data Readiness Percentage"
), 1) %>%
formatStyle("DIWS Product Ready Percentage",
background = styleColorBar(
table_to_print$`DIWS Product Ready Percentage`, 'lightgreen'),
backgroundSize = '95% 50%',
backgroundRepeat = 'no-repeat',
backgroundPosition = 'right') %>%
formatStyle("Overall Data Readiness Percentage",
background = styleColorBar(
table_to_print$`Overall Data Readiness Percentage`, 'lightblue'),
backgroundSize = '95% 50%',
backgroundRepeat = 'no-repeat',
backgroundPosition = 'right')
run_report(item_health_template, ns_dat_list[[6]], paste0("### ", names(ns_dat_list)[6]))
dat %>%
select(-any_of("WRA_prob_list")) %>%
select(robs_vendor_name, contains("WRA_")) %>%
mutate(sum = rowSums(across(where(is.logical)))) %>%
group_by(robs_vendor_name) %>%
summarise(`Overall Data Readiness Percentage` = mean(sum) / length(wra_names)) %>%
select(robs_vendor_name, `Overall Data Readiness Percentage`) %>%
identity() -> overall_readiness_lookup_df
dat %>%
bind_rows(tibble(
robs_vendor_name = c("fake", "fake"),
readiness_alignment = c("opportunity", "liability"),
n = c("0", "0")
)) %>%
count(robs_vendor_name, readiness_alignment) %>%
mutate(
readiness_alignment = readiness_alignment %>%
str_to_lower %>%
str_replace(" ", "_")
) %>%
pivot_wider(names_from = readiness_alignment, values_from = n, values_fill = 0) %>%
identity() -> readiness_alignment_lookup_df
dat %>%
count(robs_vendor_name,
DIWS_ready_counts = ifelse(DIWS_ready, "DIWS Ready", "Not DIWS Ready")) %>%
left_join(overall_readiness_lookup_df) %>%
left_join({
dat %>%
filter(`Display in Web Site` == "Yes") %>%
count(robs_vendor_name, name = "Live")
}) %>%
mutate(across(everything(), as.character)) %>%
bind_rows(tibble(
robs_vendor_name = c("fake", "fake"),
DIWS_ready_counts = c("DIWS Ready", "Not DIWS Ready"),
n = c("0", "0")
)) %>%
mutate(across(everything(), parse_guess)) %>%
pivot_wider(names_from = DIWS_ready_counts, values_from = n, values_fill = 0) %>%
mutate(
`Total Product Count` = `DIWS Ready` + `Not DIWS Ready`,
`DIWS Ready %` = `DIWS Ready` / `Total Product Count`,
Live = case_when(!is.na(Live) ~ Live, Manufacturer65 ~ 0),
`Live %` = Live / `Total Product Count`
) %>%
left_join(readiness_alignment_lookup_df) %>%
filter(robs_vendor_name != "fake") %>%
identity() -> ready_df
dat %>%
select(-any_of("WRA_prob_list")) %>%
filter(!DIWS_ready) %>%
select(Name, robs_vendor_name, contains("WRA_")) %>%
rename_with(~{str_remove(.x, "WRA_")}) %>%
pivot_longer(-c(Name, robs_vendor_name), names_to = "assessment", values_to = "assessment_is_good") %>%
filter(!assessment_is_good) %>%
count(robs_vendor_name, assessment, sort = T) %>%
mutate(prob_counts = paste0(assessment, "_", n)) %>%
select(-assessment)%>%
group_by(robs_vendor_name) %>%
summarise(
prob_count = sum(n),
prob_type_count = n(),
count_type_ratio = (prob_count / prob_type_count) %>% round(2),
prob_list = paste0(prob_counts, collapse = ", ")
) %>%
full_join(ready_df) %>%
select(
Vendor = robs_vendor_name,
`Total Product Count`,
Live, `Live %`,
`Opportunity Count` = opportunity,
`Liability Count` = liability,
`DIWS Product Ready Count` = `DIWS Ready`,
`DIWS Product Ready Percentage` = `DIWS Ready %`,
`Not DIWS Ready`,
`Overall Data Readiness Percentage`,
`Problem Value Count` = prob_count,
`Problem Type Count` = prob_type_count,
`Problem List` = prob_list
) %>%
# filter(Vendor == "Manufacturer63")
identity() -> table_to_print
col_hide_list <- c("Live", "Live %", "Opportunity Count", "Liability Count", "Problem List")
col_hide_targets <- which(colnames(table_to_print) %in% col_hide_list) - 1
table_to_print %>%
datatable(
rownames = F,
filter = "top",
extensions = "Buttons",
options = list(
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis"),
columnDefs = list(
list(extend = 'colvis', visible = F, targets = col_hide_targets),
list(width = "20%", targets = 0)
)
)
) %>%
formatPercentage(c(
"Live %",
"DIWS Product Ready Percentage",
"Overall Data Readiness Percentage"
), 1) %>%
formatStyle("DIWS Product Ready Percentage",
background = styleColorBar(
table_to_print$`DIWS Product Ready Percentage`, 'lightgreen'),
backgroundSize = '95% 50%',
backgroundRepeat = 'no-repeat',
backgroundPosition = 'right') %>%
formatStyle("Overall Data Readiness Percentage",
background = styleColorBar(
table_to_print$`Overall Data Readiness Percentage`, 'lightblue'),
backgroundSize = '95% 50%',
backgroundRepeat = 'no-repeat',
backgroundPosition = 'right')
# run_report(item_health_template, ns_dat_list[[6]], paste0("### ", names(ns_dat_list)[7]))
assessment_name_lookup_df <- tribble(
~tidied_name, ~table_label,
"FAIL_PRI_pref_eq_pur", "Preferred Price fails to be equal to Purchase Price",
"FAIL_PRI_base_gte_pur", "Base Price fails to be greater than or equal to Purchase Price",
"FAIL_PRI_base_nna", "Base Price fails to be populated",
"FAIL_PRI_sdb_meta_nna", "SDB | Price Meta fails to be populated",
"FAIL_PRI_uoms_nna_match", "UOMs fail to be populated or fail to match",
"FAIL_PRI_cul_nnfs", "Specially fulfilled item is Not For Sale or has a Reason",
"FAIL_SHP_dims_nna", "Item fails to have all four shipping dimensions populated",
"FAIL_CNT_dn_fam_match", "The Display Name fields do not all match",
"FAIL_CNT_bull_nna", "Bullets are missing",
# "FAIL_CNT_desc_nna", "Long Description is missing",
# "FAIL_CAT_com_nna", "Commerce Categories are missing",
# "FAIL_CAT_fac_nna", "Facet Categories are missing",
# "FAIL_CAT_align", "Commerce and Facet Categories are misaligned",
"FAIL_min_qty_nna_gt0", "Minimum Quantity fails to be greater than zero",
"FAIL_avatax_nna", "AvaTax Taxcode is missing",
"FAIL_vendor_nna", "Vendor is missing",
"FAIL_vendor_name_nna", "Vendor Name is missing",
"FAIL_has_image", "Item fails to have any images in NetSuite"
)
# cat("Here are the criteria that may make a record fail to qualify as Display-in-Web-Site-Ready.\n")
cat(c(
"Here are the criteria that may make a record fail to qualify as Display-in-Web-Site-Ready.\n",
paste('-', assessment_name_lookup_df$table_label)), sep = '\n')
Here are the criteria that may make a record fail to qualify as Display-in-Web-Site-Ready.
run_report(item_health_finer_template, ns_dat_list[[1]], paste0("### ", names(ns_dat_list)[1]))
assessment_name_lookup_df <- tribble(
~tidied_name, ~table_label,
"FAIL_PRI_pref_eq_pur", "Preferred Price fails to be equal to Purchase Price",
"FAIL_PRI_base_gte_pur", "Base Price fails to be greater than or equal to Purchase Price",
"FAIL_PRI_base_nna", "Base Price fails to be populated",
# "FAIL_PRI_sdb_meta_nna", "SDB | Price Meta fails to be populated",
"FAIL_PRI_mcr_nna", "Marketplace Commission Rate fails to be populated",
"FAIL_PRI_uoms_nna_match", "UOMs fail to be populated or fail to match",
"FAIL_PRI_cul_nnfs", "Specially fulfilled item is Not For Sale or has a Reason",
"FAIL_SHP_dims_nna", "Item fails to have all four shipping dimensions populated",
"FAIL_CNT_dn_fam_match", "The Display Name fields do not all match",
"FAIL_CNT_bull_nna", "Bullets are missing",
# "FAIL_CNT_desc_nna", "Long Description is missing",
# "FAIL_CAT_com_nna", "Commerce Categories are missing",
# "FAIL_CAT_fac_nna", "Facet Categories are missing",
# "FAIL_CAT_align", "Commerce and Facet Categories are misaligned",
"FAIL_min_qty_nna_gt0", "Minimum Quantity fails to be greater than zero",
"FAIL_avatax_nna", "AvaTax Taxcode is missing",
"FAIL_vendor_nna", "Vendor is missing",
"FAIL_vendor_name_nna", "Vendor Name is missing",
"FAIL_has_image", "Item fails to have any images in NetSuite"
)
dat %>%
group_by(robs_vendor_name) %>%
# select(contains("WRA_")) %>% head %>% view
select(-any_of("WRA_prob_list")) %>%
summarise(
`Total Records` = n(),
across(contains("WRA_"), ~{sum(!.x)})
) %>%
rename_with(~{paste0("FAIL_", .x)}, .cols = contains("WRA_")) %>%
rename_with(~{str_remove(.x, "WRA_")}) %>%
select(robs_vendor_name, `Total Records`, all_of(assessment_name_lookup_df$tidied_name)) %>%
column_to_rownames("robs_vendor_name") %>%
rename_via_table(assessment_name_lookup_df) %>%
datatable(
colnames = c('Vendor' = 1),
filter = "top",
extensions = 'FixedColumns',
options = list(
scrollX = Manufacturer65,
fixedColumns = Manufacturer65,
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis")
)
)
run_report(item_health_finer_template, ns_dat_list[[2]], paste0("### ", names(ns_dat_list)[2]))
assessment_name_lookup_df <- tribble(
~tidied_name, ~table_label,
"FAIL_PRI_pref_eq_pur", "Preferred Price fails to be equal to Purchase Price",
"FAIL_PRI_base_gte_pur", "Base Price fails to be greater than or equal to Purchase Price",
"FAIL_PRI_base_nna", "Base Price fails to be populated",
# "FAIL_PRI_sdb_meta_nna", "SDB | Price Meta fails to be populated",
"FAIL_PRI_mcr_nna", "Marketplace Commission Rate fails to be populated",
"FAIL_PRI_uoms_nna_match", "UOMs fail to be populated or fail to match",
"FAIL_PRI_cul_nnfs", "Specially fulfilled item is Not For Sale or has a Reason",
"FAIL_SHP_dims_nna", "Item fails to have all four shipping dimensions populated",
"FAIL_CNT_dn_fam_match", "The Display Name fields do not all match",
"FAIL_CNT_bull_nna", "Bullets are missing",
# "FAIL_CNT_desc_nna", "Long Description is missing",
# "FAIL_CAT_com_nna", "Commerce Categories are missing",
# "FAIL_CAT_fac_nna", "Facet Categories are missing",
# "FAIL_CAT_align", "Commerce and Facet Categories are misaligned",
"FAIL_min_qty_nna_gt0", "Minimum Quantity fails to be greater than zero",
"FAIL_avatax_nna", "AvaTax Taxcode is missing",
"FAIL_vendor_nna", "Vendor is missing",
"FAIL_vendor_name_nna", "Vendor Name is missing",
"FAIL_has_image", "Item fails to have any images in NetSuite"
)
dat %>%
group_by(robs_vendor_name) %>%
# select(contains("WRA_")) %>% head %>% view
select(-any_of("WRA_prob_list")) %>%
summarise(
`Total Records` = n(),
across(contains("WRA_"), ~{sum(!.x)})
) %>%
rename_with(~{paste0("FAIL_", .x)}, .cols = contains("WRA_")) %>%
rename_with(~{str_remove(.x, "WRA_")}) %>%
select(robs_vendor_name, `Total Records`, all_of(assessment_name_lookup_df$tidied_name)) %>%
column_to_rownames("robs_vendor_name") %>%
rename_via_table(assessment_name_lookup_df) %>%
datatable(
colnames = c('Vendor' = 1),
filter = "top",
extensions = 'FixedColumns',
options = list(
scrollX = Manufacturer65,
fixedColumns = Manufacturer65,
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis")
)
)
run_report(item_health_finer_template, ns_dat_list[[3]], paste0("### ", names(ns_dat_list)[3]))
assessment_name_lookup_df <- tribble(
~tidied_name, ~table_label,
"FAIL_PRI_pref_eq_pur", "Preferred Price fails to be equal to Purchase Price",
"FAIL_PRI_base_gte_pur", "Base Price fails to be greater than or equal to Purchase Price",
"FAIL_PRI_base_nna", "Base Price fails to be populated",
# "FAIL_PRI_sdb_meta_nna", "SDB | Price Meta fails to be populated",
"FAIL_PRI_mcr_nna", "Marketplace Commission Rate fails to be populated",
"FAIL_PRI_uoms_nna_match", "UOMs fail to be populated or fail to match",
"FAIL_PRI_cul_nnfs", "Specially fulfilled item is Not For Sale or has a Reason",
"FAIL_SHP_dims_nna", "Item fails to have all four shipping dimensions populated",
"FAIL_CNT_dn_fam_match", "The Display Name fields do not all match",
"FAIL_CNT_bull_nna", "Bullets are missing",
# "FAIL_CNT_desc_nna", "Long Description is missing",
# "FAIL_CAT_com_nna", "Commerce Categories are missing",
# "FAIL_CAT_fac_nna", "Facet Categories are missing",
# "FAIL_CAT_align", "Commerce and Facet Categories are misaligned",
"FAIL_min_qty_nna_gt0", "Minimum Quantity fails to be greater than zero",
"FAIL_avatax_nna", "AvaTax Taxcode is missing",
"FAIL_vendor_nna", "Vendor is missing",
"FAIL_vendor_name_nna", "Vendor Name is missing",
"FAIL_has_image", "Item fails to have any images in NetSuite"
)
dat %>%
group_by(robs_vendor_name) %>%
# select(contains("WRA_")) %>% head %>% view
select(-any_of("WRA_prob_list")) %>%
summarise(
`Total Records` = n(),
across(contains("WRA_"), ~{sum(!.x)})
) %>%
rename_with(~{paste0("FAIL_", .x)}, .cols = contains("WRA_")) %>%
rename_with(~{str_remove(.x, "WRA_")}) %>%
select(robs_vendor_name, `Total Records`, all_of(assessment_name_lookup_df$tidied_name)) %>%
column_to_rownames("robs_vendor_name") %>%
rename_via_table(assessment_name_lookup_df) %>%
datatable(
colnames = c('Vendor' = 1),
filter = "top",
extensions = 'FixedColumns',
options = list(
scrollX = Manufacturer65,
fixedColumns = Manufacturer65,
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis")
)
)
run_report(item_health_finer_template, ns_dat_list[[4]], paste0("### ", names(ns_dat_list)[4]))
assessment_name_lookup_df <- tribble(
~tidied_name, ~table_label,
"FAIL_PRI_pref_eq_pur", "Preferred Price fails to be equal to Purchase Price",
"FAIL_PRI_base_gte_pur", "Base Price fails to be greater than or equal to Purchase Price",
"FAIL_PRI_base_nna", "Base Price fails to be populated",
# "FAIL_PRI_sdb_meta_nna", "SDB | Price Meta fails to be populated",
"FAIL_PRI_mcr_nna", "Marketplace Commission Rate fails to be populated",
"FAIL_PRI_uoms_nna_match", "UOMs fail to be populated or fail to match",
"FAIL_PRI_cul_nnfs", "Specially fulfilled item is Not For Sale or has a Reason",
"FAIL_SHP_dims_nna", "Item fails to have all four shipping dimensions populated",
"FAIL_CNT_dn_fam_match", "The Display Name fields do not all match",
"FAIL_CNT_bull_nna", "Bullets are missing",
# "FAIL_CNT_desc_nna", "Long Description is missing",
# "FAIL_CAT_com_nna", "Commerce Categories are missing",
# "FAIL_CAT_fac_nna", "Facet Categories are missing",
# "FAIL_CAT_align", "Commerce and Facet Categories are misaligned",
"FAIL_min_qty_nna_gt0", "Minimum Quantity fails to be greater than zero",
"FAIL_avatax_nna", "AvaTax Taxcode is missing",
"FAIL_vendor_nna", "Vendor is missing",
"FAIL_vendor_name_nna", "Vendor Name is missing",
"FAIL_has_image", "Item fails to have any images in NetSuite"
)
dat %>%
group_by(robs_vendor_name) %>%
# select(contains("WRA_")) %>% head %>% view
select(-any_of("WRA_prob_list")) %>%
summarise(
`Total Records` = n(),
across(contains("WRA_"), ~{sum(!.x)})
) %>%
rename_with(~{paste0("FAIL_", .x)}, .cols = contains("WRA_")) %>%
rename_with(~{str_remove(.x, "WRA_")}) %>%
select(robs_vendor_name, `Total Records`, all_of(assessment_name_lookup_df$tidied_name)) %>%
column_to_rownames("robs_vendor_name") %>%
rename_via_table(assessment_name_lookup_df) %>%
datatable(
colnames = c('Vendor' = 1),
filter = "top",
extensions = 'FixedColumns',
options = list(
scrollX = Manufacturer65,
fixedColumns = Manufacturer65,
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis")
)
)
run_report(item_health_finer_template, ns_dat_list[[5]], paste0("### ", names(ns_dat_list)[5]))
assessment_name_lookup_df <- tribble(
~tidied_name, ~table_label,
"FAIL_PRI_pref_eq_pur", "Preferred Price fails to be equal to Purchase Price",
"FAIL_PRI_base_gte_pur", "Base Price fails to be greater than or equal to Purchase Price",
"FAIL_PRI_base_nna", "Base Price fails to be populated",
# "FAIL_PRI_sdb_meta_nna", "SDB | Price Meta fails to be populated",
"FAIL_PRI_mcr_nna", "Marketplace Commission Rate fails to be populated",
"FAIL_PRI_uoms_nna_match", "UOMs fail to be populated or fail to match",
"FAIL_PRI_cul_nnfs", "Specially fulfilled item is Not For Sale or has a Reason",
"FAIL_SHP_dims_nna", "Item fails to have all four shipping dimensions populated",
"FAIL_CNT_dn_fam_match", "The Display Name fields do not all match",
"FAIL_CNT_bull_nna", "Bullets are missing",
# "FAIL_CNT_desc_nna", "Long Description is missing",
# "FAIL_CAT_com_nna", "Commerce Categories are missing",
# "FAIL_CAT_fac_nna", "Facet Categories are missing",
# "FAIL_CAT_align", "Commerce and Facet Categories are misaligned",
"FAIL_min_qty_nna_gt0", "Minimum Quantity fails to be greater than zero",
"FAIL_avatax_nna", "AvaTax Taxcode is missing",
"FAIL_vendor_nna", "Vendor is missing",
"FAIL_vendor_name_nna", "Vendor Name is missing",
"FAIL_has_image", "Item fails to have any images in NetSuite"
)
dat %>%
group_by(robs_vendor_name) %>%
# select(contains("WRA_")) %>% head %>% view
select(-any_of("WRA_prob_list")) %>%
summarise(
`Total Records` = n(),
across(contains("WRA_"), ~{sum(!.x)})
) %>%
rename_with(~{paste0("FAIL_", .x)}, .cols = contains("WRA_")) %>%
rename_with(~{str_remove(.x, "WRA_")}) %>%
select(robs_vendor_name, `Total Records`, all_of(assessment_name_lookup_df$tidied_name)) %>%
column_to_rownames("robs_vendor_name") %>%
rename_via_table(assessment_name_lookup_df) %>%
datatable(
colnames = c('Vendor' = 1),
filter = "top",
extensions = 'FixedColumns',
options = list(
scrollX = Manufacturer65,
fixedColumns = Manufacturer65,
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis")
)
)
run_report(item_health_finer_template, ns_dat_list[[6]], paste0("### ", names(ns_dat_list)[6]))
assessment_name_lookup_df <- tribble(
~tidied_name, ~table_label,
"FAIL_PRI_pref_eq_pur", "Preferred Price fails to be equal to Purchase Price",
"FAIL_PRI_base_gte_pur", "Base Price fails to be greater than or equal to Purchase Price",
"FAIL_PRI_base_nna", "Base Price fails to be populated",
# "FAIL_PRI_sdb_meta_nna", "SDB | Price Meta fails to be populated",
"FAIL_PRI_mcr_nna", "Marketplace Commission Rate fails to be populated",
"FAIL_PRI_uoms_nna_match", "UOMs fail to be populated or fail to match",
"FAIL_PRI_cul_nnfs", "Specially fulfilled item is Not For Sale or has a Reason",
"FAIL_SHP_dims_nna", "Item fails to have all four shipping dimensions populated",
"FAIL_CNT_dn_fam_match", "The Display Name fields do not all match",
"FAIL_CNT_bull_nna", "Bullets are missing",
# "FAIL_CNT_desc_nna", "Long Description is missing",
# "FAIL_CAT_com_nna", "Commerce Categories are missing",
# "FAIL_CAT_fac_nna", "Facet Categories are missing",
# "FAIL_CAT_align", "Commerce and Facet Categories are misaligned",
"FAIL_min_qty_nna_gt0", "Minimum Quantity fails to be greater than zero",
"FAIL_avatax_nna", "AvaTax Taxcode is missing",
"FAIL_vendor_nna", "Vendor is missing",
"FAIL_vendor_name_nna", "Vendor Name is missing",
"FAIL_has_image", "Item fails to have any images in NetSuite"
)
dat %>%
group_by(robs_vendor_name) %>%
# select(contains("WRA_")) %>% head %>% view
select(-any_of("WRA_prob_list")) %>%
summarise(
`Total Records` = n(),
across(contains("WRA_"), ~{sum(!.x)})
) %>%
rename_with(~{paste0("FAIL_", .x)}, .cols = contains("WRA_")) %>%
rename_with(~{str_remove(.x, "WRA_")}) %>%
select(robs_vendor_name, `Total Records`, all_of(assessment_name_lookup_df$tidied_name)) %>%
column_to_rownames("robs_vendor_name") %>%
rename_via_table(assessment_name_lookup_df) %>%
datatable(
colnames = c('Vendor' = 1),
filter = "top",
extensions = 'FixedColumns',
options = list(
scrollX = Manufacturer65,
fixedColumns = Manufacturer65,
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis")
)
)
# run_report(item_health_finer_template, ns_dat_list[[6]], paste0("### ", names(ns_dat_list)[7]))
run_report(gmc_plot_template, ns_dat_list[[1]], paste0("## ", names(ns_dat_list)[1]))
in_NetSuite = nrow(dat)
on_Site = nrow(dat[dat$`Display in Web Site` == "Yes", ])
in_Google_Merch_Feed = nrow(dat[dat$`GMC Feed` == "Yes",])
metrics <- c("In NetSuite", "On Website", "In Google Merchant Center")
gmc_summary_table <- tibble(
Metric = factor(metrics, levels = metrics),
`Product Count` = c(in_NetSuite, on_Site, in_Google_Merch_Feed)
)
p <- gmc_summary_table %>%
ggplot(aes(x=Metric, y=`Product Count`)) +
geom_bar(stat="identity", fill = sefa_bars_color)
ggplotly(p)
# run_report(gmc_plot_template, ns_dat_list[[2]], paste0("## ", names(ns_dat_list)[2]))
# run_report(gmc_plot_template, ns_dat_list[[3]], paste0("## ", names(ns_dat_list)[3]))
# run_report(gmc_plot_template, ns_dat_list[[4]], paste0("## ", names(ns_dat_list)[4]))
# run_report(gmc_plot_template, ns_dat_list[[5]], paste0("## ", names(ns_dat_list)[5]))
# run_report(gmc_plot_template, ns_dat_list[[6]], paste0("## ", names(ns_dat_list)[6]))
# run_report(gmc_plot_template, ns_dat_list[[6]], paste0("## ", names(ns_dat_list)[7]))
run_report(gmc_readiness_template, ns_dat_list[[1]], paste0("## ", names(ns_dat_list)[1]))
gmc_assessment_name_lookup_df <- tribble(
~tidied_name, ~table_label,
"FAIL_dn_le_150", "Display Name is greater than 150 characters",
"FAIL_desc_nna", "Product Details/Short Description Missing",
"FAIL_cat_nna", "Google Product Category Missing",
"FAIL_price_low_enough", "Price greater than $10000"
)
dat %>%
group_by(robs_vendor_name) %>%
select(-any_of("GMCRA_prob_list")) %>%
summarise(
`Total Records` = n(),
across(contains("GMCRA_"), ~{sum(!.x)})
) %>%
rename_with(~{paste0("FAIL_", .x)}, .cols = contains("GMCRA_")) %>%
rename_with(~{str_remove(.x, "GMCRA_")}) %>%
select(robs_vendor_name, `Total Records`, any_of(gmc_assessment_name_lookup_df$tidied_name)) %>%
column_to_rownames("robs_vendor_name") %>%
rename_via_table(gmc_assessment_name_lookup_df) %>%
datatable(
colnames = c('Vendor' = 1),
filter = "top",
extensions = 'FixedColumns',
options = list(
scrollX = Manufacturer65,
fixedColumns = Manufacturer65,
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis")
)
)
run_report(gmc_readiness_template, ns_dat_list[[2]], paste0("## ", names(ns_dat_list)[2]))
gmc_assessment_name_lookup_df <- tribble(
~tidied_name, ~table_label,
"FAIL_dn_le_150", "Display Name is greater than 150 characters",
"FAIL_desc_nna", "Product Details/Short Description Missing",
"FAIL_cat_nna", "Google Product Category Missing",
"FAIL_price_low_enough", "Price greater than $10000"
)
dat %>%
group_by(robs_vendor_name) %>%
select(-any_of("GMCRA_prob_list")) %>%
summarise(
`Total Records` = n(),
across(contains("GMCRA_"), ~{sum(!.x)})
) %>%
rename_with(~{paste0("FAIL_", .x)}, .cols = contains("GMCRA_")) %>%
rename_with(~{str_remove(.x, "GMCRA_")}) %>%
select(robs_vendor_name, `Total Records`, any_of(gmc_assessment_name_lookup_df$tidied_name)) %>%
column_to_rownames("robs_vendor_name") %>%
rename_via_table(gmc_assessment_name_lookup_df) %>%
datatable(
colnames = c('Vendor' = 1),
filter = "top",
extensions = 'FixedColumns',
options = list(
scrollX = Manufacturer65,
fixedColumns = Manufacturer65,
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis")
)
)
run_report(gmc_readiness_template, ns_dat_list[[3]], paste0("## ", names(ns_dat_list)[3]))
gmc_assessment_name_lookup_df <- tribble(
~tidied_name, ~table_label,
"FAIL_dn_le_150", "Display Name is greater than 150 characters",
"FAIL_desc_nna", "Product Details/Short Description Missing",
"FAIL_cat_nna", "Google Product Category Missing",
"FAIL_price_low_enough", "Price greater than $10000"
)
dat %>%
group_by(robs_vendor_name) %>%
select(-any_of("GMCRA_prob_list")) %>%
summarise(
`Total Records` = n(),
across(contains("GMCRA_"), ~{sum(!.x)})
) %>%
rename_with(~{paste0("FAIL_", .x)}, .cols = contains("GMCRA_")) %>%
rename_with(~{str_remove(.x, "GMCRA_")}) %>%
select(robs_vendor_name, `Total Records`, any_of(gmc_assessment_name_lookup_df$tidied_name)) %>%
column_to_rownames("robs_vendor_name") %>%
rename_via_table(gmc_assessment_name_lookup_df) %>%
datatable(
colnames = c('Vendor' = 1),
filter = "top",
extensions = 'FixedColumns',
options = list(
scrollX = Manufacturer65,
fixedColumns = Manufacturer65,
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis")
)
)
run_report(gmc_readiness_template, ns_dat_list[[4]], paste0("## ", names(ns_dat_list)[4]))
gmc_assessment_name_lookup_df <- tribble(
~tidied_name, ~table_label,
"FAIL_dn_le_150", "Display Name is greater than 150 characters",
"FAIL_desc_nna", "Product Details/Short Description Missing",
"FAIL_cat_nna", "Google Product Category Missing",
"FAIL_price_low_enough", "Price greater than $10000"
)
dat %>%
group_by(robs_vendor_name) %>%
select(-any_of("GMCRA_prob_list")) %>%
summarise(
`Total Records` = n(),
across(contains("GMCRA_"), ~{sum(!.x)})
) %>%
rename_with(~{paste0("FAIL_", .x)}, .cols = contains("GMCRA_")) %>%
rename_with(~{str_remove(.x, "GMCRA_")}) %>%
select(robs_vendor_name, `Total Records`, any_of(gmc_assessment_name_lookup_df$tidied_name)) %>%
column_to_rownames("robs_vendor_name") %>%
rename_via_table(gmc_assessment_name_lookup_df) %>%
datatable(
colnames = c('Vendor' = 1),
filter = "top",
extensions = 'FixedColumns',
options = list(
scrollX = Manufacturer65,
fixedColumns = Manufacturer65,
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis")
)
)
run_report(gmc_readiness_template, ns_dat_list[[5]], paste0("## ", names(ns_dat_list)[5]))
gmc_assessment_name_lookup_df <- tribble(
~tidied_name, ~table_label,
"FAIL_dn_le_150", "Display Name is greater than 150 characters",
"FAIL_desc_nna", "Product Details/Short Description Missing",
"FAIL_cat_nna", "Google Product Category Missing",
"FAIL_price_low_enough", "Price greater than $10000"
)
dat %>%
group_by(robs_vendor_name) %>%
select(-any_of("GMCRA_prob_list")) %>%
summarise(
`Total Records` = n(),
across(contains("GMCRA_"), ~{sum(!.x)})
) %>%
rename_with(~{paste0("FAIL_", .x)}, .cols = contains("GMCRA_")) %>%
rename_with(~{str_remove(.x, "GMCRA_")}) %>%
select(robs_vendor_name, `Total Records`, any_of(gmc_assessment_name_lookup_df$tidied_name)) %>%
column_to_rownames("robs_vendor_name") %>%
rename_via_table(gmc_assessment_name_lookup_df) %>%
datatable(
colnames = c('Vendor' = 1),
filter = "top",
extensions = 'FixedColumns',
options = list(
scrollX = Manufacturer65,
fixedColumns = Manufacturer65,
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis")
)
)
# run_report(gmc_readiness_template, ns_dat_list[[6]], paste0("## ", names(ns_dat_list)[6]))
# run_report(gmc_readiness_template, ns_dat_list[[6]], paste0("## ", names(ns_dat_list)[7]))
# run_report(gmc_readiness_template, ns_dat_list[[6]], paste0("## ", names(ns_dat_list)[8]))
Note: dealer fulfilled products are excluded from this section.
PRGPP)(Sale Price - Purchase Price)/Sale Price,
where: Sale Price = MAP Price or
Base Price, whichever is populated for the product, and
Sale Price = Base Price if both are
present.
i.e. the mean is the average of each individual product’s margin percent.
ARGPP)(Sale Price - Purchase Price + CDGR)/Sale Price,
where CDGR = Cash Discount $ +
Guaranteed Rebate $ and Sale Price is defined
as above.
*Note that this reports treats empty values in NetSuite for
Cash Discount $ and Guaranteed Rebate $ as
zeroes.
run_report(pricing_margins_template, ns_dat_list[[1]], paste0("### ", names(ns_dat_list)[1]))
dat %>%
filter(dealer_count == 0) %>%
group_by(robs_vendor_name) %>%
summarise(
mean_PRGPP = mean(pre_rebate_GPP, na.rm = T),
min_PRGPP = min(pre_rebate_GPP, na.rm = T),
max_PRGPP = max(pre_rebate_GPP, na.rm = T),
mean_ARGPP = mean(after_rebate_GPP, na.rm = T),
min_ARGPP = min(after_rebate_GPP, na.rm = T),
max_ARGPP = max(after_rebate_GPP, na.rm = T)
) %>%
datatable(
rownames = F,
filter = "top",
editable = T,
extensions = "Buttons",
options = list(
dom = 'Blfrtip',
# pageLength = 25,
buttons = c("copy", "excel", "colvis"),
columnDefs = list(list(className = 'dt-center', targets = 1))
)
) %>%
formatPercentage(c("mean_PRGPP", "min_PRGPP", "max_PRGPP"), 1) %>%
formatPercentage(c("mean_ARGPP", "min_ARGPP", "max_ARGPP"), 1)
run_report(pricing_margins_template, ns_dat_list[[2]], paste0("### ", names(ns_dat_list)[2]))
dat %>%
filter(dealer_count == 0) %>%
group_by(robs_vendor_name) %>%
summarise(
mean_PRGPP = mean(pre_rebate_GPP, na.rm = T),
min_PRGPP = min(pre_rebate_GPP, na.rm = T),
max_PRGPP = max(pre_rebate_GPP, na.rm = T),
mean_ARGPP = mean(after_rebate_GPP, na.rm = T),
min_ARGPP = min(after_rebate_GPP, na.rm = T),
max_ARGPP = max(after_rebate_GPP, na.rm = T)
) %>%
datatable(
rownames = F,
filter = "top",
editable = T,
extensions = "Buttons",
options = list(
dom = 'Blfrtip',
# pageLength = 25,
buttons = c("copy", "excel", "colvis"),
columnDefs = list(list(className = 'dt-center', targets = 1))
)
) %>%
formatPercentage(c("mean_PRGPP", "min_PRGPP", "max_PRGPP"), 1) %>%
formatPercentage(c("mean_ARGPP", "min_ARGPP", "max_ARGPP"), 1)
run_report(pricing_margins_template, ns_dat_list[[3]], paste0("### ", names(ns_dat_list)[3]))
dat %>%
filter(dealer_count == 0) %>%
group_by(robs_vendor_name) %>%
summarise(
mean_PRGPP = mean(pre_rebate_GPP, na.rm = T),
min_PRGPP = min(pre_rebate_GPP, na.rm = T),
max_PRGPP = max(pre_rebate_GPP, na.rm = T),
mean_ARGPP = mean(after_rebate_GPP, na.rm = T),
min_ARGPP = min(after_rebate_GPP, na.rm = T),
max_ARGPP = max(after_rebate_GPP, na.rm = T)
) %>%
datatable(
rownames = F,
filter = "top",
editable = T,
extensions = "Buttons",
options = list(
dom = 'Blfrtip',
# pageLength = 25,
buttons = c("copy", "excel", "colvis"),
columnDefs = list(list(className = 'dt-center', targets = 1))
)
) %>%
formatPercentage(c("mean_PRGPP", "min_PRGPP", "max_PRGPP"), 1) %>%
formatPercentage(c("mean_ARGPP", "min_ARGPP", "max_ARGPP"), 1)
run_report(pricing_margins_template, ns_dat_list[[4]], paste0("### ", names(ns_dat_list)[4]))
dat %>%
filter(dealer_count == 0) %>%
group_by(robs_vendor_name) %>%
summarise(
mean_PRGPP = mean(pre_rebate_GPP, na.rm = T),
min_PRGPP = min(pre_rebate_GPP, na.rm = T),
max_PRGPP = max(pre_rebate_GPP, na.rm = T),
mean_ARGPP = mean(after_rebate_GPP, na.rm = T),
min_ARGPP = min(after_rebate_GPP, na.rm = T),
max_ARGPP = max(after_rebate_GPP, na.rm = T)
) %>%
datatable(
rownames = F,
filter = "top",
editable = T,
extensions = "Buttons",
options = list(
dom = 'Blfrtip',
# pageLength = 25,
buttons = c("copy", "excel", "colvis"),
columnDefs = list(list(className = 'dt-center', targets = 1))
)
) %>%
formatPercentage(c("mean_PRGPP", "min_PRGPP", "max_PRGPP"), 1) %>%
formatPercentage(c("mean_ARGPP", "min_ARGPP", "max_ARGPP"), 1)
run_report(pricing_margins_template, ns_dat_list[[5]], paste0("### ", names(ns_dat_list)[5]))
dat %>%
filter(dealer_count == 0) %>%
group_by(robs_vendor_name) %>%
summarise(
mean_PRGPP = mean(pre_rebate_GPP, na.rm = T),
min_PRGPP = min(pre_rebate_GPP, na.rm = T),
max_PRGPP = max(pre_rebate_GPP, na.rm = T),
mean_ARGPP = mean(after_rebate_GPP, na.rm = T),
min_ARGPP = min(after_rebate_GPP, na.rm = T),
max_ARGPP = max(after_rebate_GPP, na.rm = T)
) %>%
datatable(
rownames = F,
filter = "top",
editable = T,
extensions = "Buttons",
options = list(
dom = 'Blfrtip',
# pageLength = 25,
buttons = c("copy", "excel", "colvis"),
columnDefs = list(list(className = 'dt-center', targets = 1))
)
) %>%
formatPercentage(c("mean_PRGPP", "min_PRGPP", "max_PRGPP"), 1) %>%
formatPercentage(c("mean_ARGPP", "min_ARGPP", "max_ARGPP"), 1)
run_report(pricing_margins_template, ns_dat_list[[6]], paste0("### ", names(ns_dat_list)[6]))
dat %>%
filter(dealer_count == 0) %>%
group_by(robs_vendor_name) %>%
summarise(
mean_PRGPP = mean(pre_rebate_GPP, na.rm = T),
min_PRGPP = min(pre_rebate_GPP, na.rm = T),
max_PRGPP = max(pre_rebate_GPP, na.rm = T),
mean_ARGPP = mean(after_rebate_GPP, na.rm = T),
min_ARGPP = min(after_rebate_GPP, na.rm = T),
max_ARGPP = max(after_rebate_GPP, na.rm = T)
) %>%
datatable(
rownames = F,
filter = "top",
editable = T,
extensions = "Buttons",
options = list(
dom = 'Blfrtip',
# pageLength = 25,
buttons = c("copy", "excel", "colvis"),
columnDefs = list(list(className = 'dt-center', targets = 1))
)
) %>%
formatPercentage(c("mean_PRGPP", "min_PRGPP", "max_PRGPP"), 1) %>%
formatPercentage(c("mean_ARGPP", "min_ARGPP", "max_ARGPP"), 1)
# run_report(pricing_margins_template, ns_dat_list[[6]], paste0("### ", names(ns_dat_list)[7]))
Here are counts for how many products in this data set are flagged
Not For Sale by value of Not for Sale Reason.
For more detail of counts by supplier, ask the Data Architect.
run_report(nfs_reason_count_template, ns_dat_list[[1]], paste0("## ", names(ns_dat_list)[1]))
dat %>%
count(`Not For Sale Reason`) %>%
filter(!is.na(`Not For Sale Reason`)) %>%
datatable()
run_report(nfs_reason_count_template, ns_dat_list[[2]], paste0("## ", names(ns_dat_list)[2]))
dat %>%
count(`Not For Sale Reason`) %>%
filter(!is.na(`Not For Sale Reason`)) %>%
datatable()
run_report(nfs_reason_count_template, ns_dat_list[[3]], paste0("## ", names(ns_dat_list)[3]))
dat %>%
count(`Not For Sale Reason`) %>%
filter(!is.na(`Not For Sale Reason`)) %>%
datatable()
run_report(nfs_reason_count_template, ns_dat_list[[4]], paste0("## ", names(ns_dat_list)[4]))
dat %>%
count(`Not For Sale Reason`) %>%
filter(!is.na(`Not For Sale Reason`)) %>%
datatable()
run_report(nfs_reason_count_template, ns_dat_list[[5]], paste0("## ", names(ns_dat_list)[5]))
dat %>%
count(`Not For Sale Reason`) %>%
filter(!is.na(`Not For Sale Reason`)) %>%
datatable()
run_report(nfs_reason_count_template, ns_dat_list[[6]], paste0("## ", names(ns_dat_list)[6]))
dat %>%
count(`Not For Sale Reason`) %>%
filter(!is.na(`Not For Sale Reason`)) %>%
datatable()
# run_report(nfs_reason_count_template, ns_dat_list[[6]], paste0("## ", names(ns_dat_list)[7]))
run_report(dealer_fulfilled_count_template, ns_dat_list[[1]], paste0("## ", names(ns_dat_list)[1]))
col_hide_targets = c()
dealer_data_long_df %>%
filter(Name %in% dat$Name) %>%
filter(dealer_code != "SPECIAL") %>%
filter(supplier_code != "CLOSEOUT") %>%
# count(dealer_code, supplier_code) %>%
# pivot_wider(
# names_from = "dealer_code",
# names_glue = "{dealer_code}_count",
# values_from = "n",
# values_fill = 0) %>%
# untabyl() %>%
tabyl(supplier_code, dealer_code) %>%
adorn_totals(where = "row") %>%
mutate(supplier_code = str_replace(supplier_code, "Total", "_Total")) %>%
arrange(supplier_code) %>%
datatable(
rownames = F,
filter = "top",
extensions = "Buttons",
options = list(
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis"),
columnDefs = list(
list(extend = 'colvis', visible = F, targets = col_hide_targets),
list(width = "20%", targets = 0)
)
)
)
run_report(dealer_fulfilled_count_template, ns_dat_list[[2]], paste0("## ", names(ns_dat_list)[2]))
col_hide_targets = c()
dealer_data_long_df %>%
filter(Name %in% dat$Name) %>%
filter(dealer_code != "SPECIAL") %>%
filter(supplier_code != "CLOSEOUT") %>%
# count(dealer_code, supplier_code) %>%
# pivot_wider(
# names_from = "dealer_code",
# names_glue = "{dealer_code}_count",
# values_from = "n",
# values_fill = 0) %>%
# untabyl() %>%
tabyl(supplier_code, dealer_code) %>%
adorn_totals(where = "row") %>%
mutate(supplier_code = str_replace(supplier_code, "Total", "_Total")) %>%
arrange(supplier_code) %>%
datatable(
rownames = F,
filter = "top",
extensions = "Buttons",
options = list(
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis"),
columnDefs = list(
list(extend = 'colvis', visible = F, targets = col_hide_targets),
list(width = "20%", targets = 0)
)
)
)
# This module doesn't make sense (and breaks) for dealerless items.
# run_report(dealer_fulfilled_count_template, ns_dat_list[[3]], paste0("## ", names(ns_dat_list)[3]))
run_report(dealer_fulfilled_count_template, ns_dat_list[[4]], paste0("## ", names(ns_dat_list)[4]))
col_hide_targets = c()
dealer_data_long_df %>%
filter(Name %in% dat$Name) %>%
filter(dealer_code != "SPECIAL") %>%
filter(supplier_code != "CLOSEOUT") %>%
# count(dealer_code, supplier_code) %>%
# pivot_wider(
# names_from = "dealer_code",
# names_glue = "{dealer_code}_count",
# values_from = "n",
# values_fill = 0) %>%
# untabyl() %>%
tabyl(supplier_code, dealer_code) %>%
adorn_totals(where = "row") %>%
mutate(supplier_code = str_replace(supplier_code, "Total", "_Total")) %>%
arrange(supplier_code) %>%
datatable(
rownames = F,
filter = "top",
extensions = "Buttons",
options = list(
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis"),
columnDefs = list(
list(extend = 'colvis', visible = F, targets = col_hide_targets),
list(width = "20%", targets = 0)
)
)
)
run_report(dealer_fulfilled_count_template, ns_dat_list[[5]], paste0("## ", names(ns_dat_list)[5]))
col_hide_targets = c()
dealer_data_long_df %>%
filter(Name %in% dat$Name) %>%
filter(dealer_code != "SPECIAL") %>%
filter(supplier_code != "CLOSEOUT") %>%
# count(dealer_code, supplier_code) %>%
# pivot_wider(
# names_from = "dealer_code",
# names_glue = "{dealer_code}_count",
# values_from = "n",
# values_fill = 0) %>%
# untabyl() %>%
tabyl(supplier_code, dealer_code) %>%
adorn_totals(where = "row") %>%
mutate(supplier_code = str_replace(supplier_code, "Total", "_Total")) %>%
arrange(supplier_code) %>%
datatable(
rownames = F,
filter = "top",
extensions = "Buttons",
options = list(
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis"),
columnDefs = list(
list(extend = 'colvis', visible = F, targets = col_hide_targets),
list(width = "20%", targets = 0)
)
)
)
run_report(dealer_fulfilled_count_template, ns_dat_list[[6]], paste0("## ", names(ns_dat_list)[6]))
col_hide_targets = c()
dealer_data_long_df %>%
filter(Name %in% dat$Name) %>%
filter(dealer_code != "SPECIAL") %>%
filter(supplier_code != "CLOSEOUT") %>%
# count(dealer_code, supplier_code) %>%
# pivot_wider(
# names_from = "dealer_code",
# names_glue = "{dealer_code}_count",
# values_from = "n",
# values_fill = 0) %>%
# untabyl() %>%
tabyl(supplier_code, dealer_code) %>%
adorn_totals(where = "row") %>%
mutate(supplier_code = str_replace(supplier_code, "Total", "_Total")) %>%
arrange(supplier_code) %>%
datatable(
rownames = F,
filter = "top",
extensions = "Buttons",
options = list(
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis"),
columnDefs = list(
list(extend = 'colvis', visible = F, targets = col_hide_targets),
list(width = "20%", targets = 0)
)
)
)
# run_report(dealer_fulfilled_count_template, ns_dat_list[[6]], paste0("## ", names(ns_dat_list)[7]))
knitr::knit_child(pre_netsuite_dealer_report, envir = environment(), quiet = Manufacturer65) %>% cat
col_hide_targets = c()
pns_dv_df %>%
mutate(dealer_code = str_sub(dealer_sku, 1, 4)) %>%
count(dealer_code, match_status) %>%
pivot_wider(
names_from = match_status,
values_from = n,
values_fill = 0
) %>%
enrich_join(dealer_metadata_df, dealer_code, `Dealer name`) %>%
mutate(Dealer = word(`Dealer name`)) %>%
select(Dealer, everything()) %>%
select(-dealer_code, - `Dealer name`) %>%
adorn_totals(where = "row") %>%
mutate(Total = select(., where(is.numeric)) %>%
rowSums(na.rm = Manufacturer65)) %>%
datatable(
rownames = F,
filter = "top",
extensions = "Buttons",
options = list(
dom = 'Blfrtip',
buttons = c("copy", "excel", "colvis"),
pageLength = 15,
columnDefs = list(
list(extend = 'colvis', visible = F, targets = col_hide_targets)
# list(width = "20%", targets = 0)
)
)
)